import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class App5 {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        Class.forName("com.mysql.jdbc.Driver");
        String url = "jdbc:mysql://localhost:3306/test?useSSL=false";
        String name ="root";
        String password="yangxiaocheng3";
        Connection connection = DriverManager.getConnection(url, name, password);
        Statement statement = connection.createStatement();
        String sql="UPDATE `user` SET username ='competernt' WHERE id = 4";
        int i=statement.executeUpdate(sql);
        if (i>0){
            System.out.println("修改成功！");
        }
    }
}
